<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../react/react18.development.js"></script>
    <script src="../react/react-dom18.development.js"></script>
    <script src="../react/babel.min.js"></script>
</head>

<body>
    <div id="main"></div>
    <script type="text/babel">

        let num = 100;
        let arr = ['aaa', 'bbb', 'ccc'];
        function test() {
            console.log('--------');
        }
        // jsx 通过{} 单大括号来展示数据
        let aaa = (<div className='box'>
            <h2>这是一个标题</h2>
            <p>{num}</p>
            <p>{num * 10}</p>
            <p>{num > 100 ? '大于' : num == 100 ? '等于' : '小于'}</p>
            <button onClick={test}>点击</button>
            <ul>
                {/*jsx里的注释 */}
                {arr.map((item, index) => {
                    return (<li key={index}>
                        {item}</li>)
                })}
            </ul>
        </div>)

        var box = document.querySelector('#main');
        var root = ReactDOM.createRoot(box);
        root.render(aaa);

    </script>
</body>

</html>